<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title> vf</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="StyleSheet" href="<%=request.getContextPath()%>/css/dtree.css" type="text/css">
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/dtree.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            initBookSort();
        });

        function initBookSort() {
            $.getJSON("<%=request.getContextPath()%>/Book_sortServlet", "", showBookSorts);
        }
        function showBookSorts(data) {
            console.log(data);
            document.write("<body style=\"background:#fff;\"><div class=\"dtree\" >");
            d = new dTree('d');
            d.add(1, -1, '类别', 'booklist.jsp?sortId=-1', '类别', 'bookFrame');
            $(data).each(function () {
                d.add("\"" + this.id + "\"", 1, this.name, 'booklist.jsp?sortId=' + this.id, this.name, 'bookFrame');
            });
            document.write(d);
            document.write("</div></body>")
        }
    </script>
</head>
</html>
